// 将数据转化为树形结构
export const changeTreeFn = (list, id) => {
  const treeData = []
  list.forEach(item => {
    if (item.pid === id) {
      const children = changeTreeFn(list, item.id)
      if (children.length) {
        item.children = children
      }
      treeData.push(item)
    }
  })
  return treeData
}
